<?php
$sidebar =
        '<ul id=\"admin-nav\">
    <li><a href=\"' . site_url("admin/home") . '\">Admin kodu</a></li>
    <li><a href=\"' . site_url("admin/competitions") . '\">Võistlused</a></li>
    <li><a href=\"' . site_url("admin/competitions/manual") . '\">Käsitsi sisestamine</a></li>
    <li><a href=\"' . site_url("admin/tables") . '\">Aegade ja punktide tabelid</a></li>
</ul>';

$sidebar = str_replace("\n", '\n', $sidebar);
?> 

<script>
    
    $(".page-header").html("<h1>Administraatori lehekülg</h1>");
    $(".sidebar").html("<?php echo $sidebar; ?>");
    
    $(document).ready(function () {
    });

</script>

<?php
//echo form_open_multipart('files/upload_athletes');
//echo 'Vali sportlaste fail (.xml): ' . form_upload('athletes');
//echo form_submit('upload_athltes', 'Saada');
//echo form_close();
//
//echo form_open_multipart('files/upload_teams');
//echo 'Vali klubide fail (.xml): ' . form_upload('teams');
//echo form_submit('upload_teams', 'Saada');
//echo form_close();
//
//echo form_open_multipart('files/upload_mdb');
//echo 'Vali Access andmebaasi fail (.mdb): ' . form_upload('mdb');
//echo form_submit('upload_mdb', 'Saada');
//echo form_close();
?>



<div class="fragment">
    <table class="table"> 
        <caption><h4>Andmebaasi salvestatud FINA baasajad aastate ja basseinide lõikes</h4></caption>
        <thead>
            <tr><th></th>
                <?php
                foreach ($fina as $year => $pool) {
                    echo "<th>$year</th>";
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <tr><th>25 m</th>
                <?php
                foreach ($fina as $year => $pool) {
                    if (isset($fina[$year][25])) {
                        echo "<td>{$fina[$year][25]}</td>";
                    } else {
                        echo '<td></td>';
                    }
                }
                ?>
            </tr>
            <tr><th>50 m</th>
                <?php
                foreach ($fina as $year => $pool) {
                    if (isset($fina[$year][50])) {
                        echo "<td>{$fina[$year][50]}</td>";
                    } else {
                        echo '<td></td>';
                    }
                }
                ?>
            </tr>
        </tbody>
    </table>

    <div class="panel-group" id="accordion2">
        <div class="panel panel-default">
            <div class="panel-heading">
                <a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                    <h4 class="panel-title">Õpetus kuidas FINA punkte üles laadida</h4>
                </a>
            </div>
            <div id="collapseOne" class="panel-collapse collapse">
                <div class="panel-body">
                    <ol class="admin">
                        <li>Tõmba <a target="_blank" href="http://www.fina.org/H2O/index.php?option=com_content&view=article&id=1373&Itemid=641">SIIT</a> endale viimane FINA tabel Exceli (.xls) failina (FINA Points Base Times)</li>
                        <li>Ava Exceli või mõne muu kontoritarkvaraga ning salvesta kui .csv (<strong>;</strong> separated)</li>
                        <li>Näite sobilikust .csv failist leiad <a href="<?php echo base_url('uploads/files/FINA_points_basetimes_2013.csv'); ?>">SIIT</a></li>
                        <li>Vali just tehtud .csv fail alloleva vormi abil ning saada</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>

</dl>
<?php
echo form_open_multipart('files/upload_fina');
echo 'Vali FINA punktide fail (.csv): ' . form_upload('fina');
echo form_submit('upload_fina', 'Saada');
echo form_close();
?>
</div>
<div class="fragment" style="margin-top: 35px;">

    <table class="table"> 
        <caption><h4>Andmebaasi salvestatud Rudolph-Tabelle punktid aastate ja vanuste lõikes</h4></caption>
        <thead>
            <tr><th></th>
                <?php
                foreach ($rudolph as $year => $row) {
                    foreach ($rudolph[$year] as $age => $value) {
                        echo "<th>$age</th>";
                    }
                    break;
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($rudolph as $year => $row) {
                echo "<tr><th>$year</th>";
                foreach ($rudolph[$year] as $age => $value) {
                    echo "<td>{$value}</td>";
                }
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>

    <div class="panel-group" id="accordion3">
        <div class="panel panel-default">
            <div class="panel-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion3" href="#collapseTwo">
                    <h4 class="panel-title">Õpetus kuidas Rudolph-Tabelle punkte üles laadida</h4>
                </a>
            </div>
            <div id="collapseTwo" class="panel-collapse collapse">
                <div class="panel-body">
                    <ol class="admin">
                        <li>Tõmba näiteks <a target="_blank" href="http://www.hessischer-schwimm-verband.de/uploads/tx_rtgfiles/rudolph2012_01.pdf">SIIT</a> endale viimane Rudolph-Tabelle punktide fail .pdf kujul</li>
                        <li>Ava ning kopeeri terve sisu (Ctrl+A) ning kleebi suvalisse .txt faili</li>
                        <li>Näite sobilikust .txt failist leiad <a href="<?php echo base_url('uploads/files/Rudolph-Tabelle_2012.txt'); ?>">SIIT</a></li>
                        <li>Vali just tehtud .txt fail alloleva vormi abil ning saada</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>

    <?php
    echo form_open_multipart('files/upload_rudolph');
    echo 'Vali Rudolph Tabelle 2012 punktide fail (.txt): ' . form_upload('rudolph');
    echo form_submit('upload_rudolph', 'Saada');
    echo form_close();
    ?>

</div>

<div class="fragment" style="margin-top: 35px;">
    <table class="table"> 
        <caption><h4>Andmebaasi salvestatud EUL järgud meestele</h4></caption>
        <thead>
            <tr><th></th>
                <?php
                foreach ($ranks_m as $event => $row) {
                    foreach ($ranks_m[$event] as $type => $value) {
                        echo "<th>$type</th>";
                    }
                    break;
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($ranks_m as $event => $row) {
                echo "<tr><th>$event</th>";
                foreach ($ranks_m[$event] as $type => $value) {
                    echo "<td>$value</td>";
                }
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>

    <div class="panel-group" id="accordion4">
        <div class="panel panel-default">
            <div class="panel-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion4" href="#collapseThree">
                    <h4 class="panel-title">Õpetus kuidas Eesti Ujumisliidu järkude tabelit üles laadida</h4>
                </a>
            </div>
            <div id="collapseThree" class="panel-collapse collapse">
                <div class="panel-body">
                    <ol class="admin">
                        <li>Märgi <a href="http://swimming.ee/?page=sk&marx=leht_sisu&toode=258&owner=8">SIIN</a> lehel terve tabel hiirega ära ning kopeeri.</li>
                        <li>Kleebi kopeeritud tabel suvalisse .txt faili</li>
                        <li>Näite sobilikust .txt failist leiad <a href="<?php echo base_url('uploads/files/EUL_ranks_men.txt'); ?>">SIIT</a> (väärtused peavad olema tühikutega eraldatud)</li>
                        <li>Vali just tehtud .txt fail alloleva vormi abil ning saada</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>

    <?php
    echo form_open_multipart('files/upload_ranks/men');
    echo 'Vali EUL järgud meestele fail (.txt): ' . form_upload('ranks');
    echo form_submit('upload_ranks', 'Saada');
    echo form_close();
    ?>

</div>

<div class="fragment" style="margin-top: 35px;">
    <table class="table"> 
        <caption><h4>Andmebaasi salvestatud EUL järgud naistele</h4></caption>
        <thead>
            <tr><th></th>
                <?php
                foreach ($ranks_f as $event => $row) {
                    foreach ($ranks_f[$event] as $type => $value) {
                        echo "<th>$type</th>";
                    }
                    break;
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($ranks_f as $event => $row) {
                echo "<tr><th>$event</th>";
                foreach ($ranks_f[$event] as $type => $value) {
                    echo "<td>$value</td>";
                }
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>

    <?php
    echo form_open_multipart('files/upload_ranks/women');
    echo 'Vali EUL järgud naistele fail (.txt): ' . form_upload('ranks');
    echo form_submit('upload_ranks', 'Saada');
    echo form_close();
    ?>

</div>


